package com.mwx.loseweight.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mwx.loseweight.mapper.FitWeightHisMapper;
import com.mwx.loseweight.pojo.dto.FitWeightHisPageDTO;
import com.mwx.loseweight.pojo.entity.FitWeightHis;

@Service
public class FitWeightHisService {

    @Autowired
    private FitWeightHisMapper fitWeightHisMapper;


    public void save(FitWeightHis fitWeightHis) {
    	fitWeightHisMapper.insert(fitWeightHis);
    }

    public void delete(FitWeightHis fitWeightHis) {
    	fitWeightHisMapper.deleteById(fitWeightHis.getId());
    }

    public void update(FitWeightHis fitWeightHis) {
    	fitWeightHisMapper.updateById(fitWeightHis);
    }

    public FitWeightHis get(FitWeightHis fitWeightHis) {
        return fitWeightHisMapper.selectById(fitWeightHis.getId());
    }

    public Page<FitWeightHis> list(FitWeightHisPageDTO fitWeightHisPageDTO) {

        Page<FitWeightHis> page = new Page<>(fitWeightHisPageDTO.getPage(), fitWeightHisPageDTO.getPageSize());
        //下一条sql进行分页，自动加入limit关键字分页
        QueryWrapper<FitWeightHis> queryWrapper = new QueryWrapper<>();
        return fitWeightHisMapper.selectPage(page, queryWrapper);
    }

}




























